package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.BTopical;
import com.ruoyi.system.domain.request.TopicalRequest;
import com.ruoyi.system.domain.vo.BTopicalVo;
import com.ruoyi.system.service.BTopicalService;
import com.ruoyi.system.mapper.BTopicalMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author yangxingze
* @description 针对表【b_topical(专题表)】的数据库操作Service实现
* @createDate 2024-10-11 23:30:56
*/
@Service
@Slf4j
public class BTopicalServiceImpl extends ServiceImpl<BTopicalMapper, BTopical>
    implements BTopicalService{

    /**
     * 分页获取主题列表
     * @param request
     * @return
     */
    @Override
    public List<BTopicalVo> queryList(TopicalRequest request) {
        List<BTopicalVo> list = baseMapper.queryList(request);
        return list;
    }

    /**
     * 分页查询主题回复列表
     * @param topicalId
     * @return
     */
    @Override
    public List<BTopicalVo> queryReplyList(Long topicalId) {
        return baseMapper.selectReplyList(topicalId);
    }

    /**
     * 删除主题
     * @param ids
     * @return
     */
    @Override
    public int deleteTopicalByIds(Long[] ids) {
        baseMapper.deleteTopicalByParentIds(ids);
        return baseMapper.deleteTopicalByIds(ids);
    }

    /**
     * 删除回复
     * @param ids
     * @return
     */
    @Override
    public int deleteReplyByIds(Long[] ids) {
        int result =  baseMapper.deleteReplyByIds(ids);
        log.info("result:{}"+result);
        return result;
    }
}




